const koa = require("koa");
const app = new koa();
const router = require("koa-router")()
const data = require("./data/local")
router.get("/top/playlists",async ctx=>{
    var {offset,limit} = ctx.request.query;
    offset = Number(offset)
    limit = Number(limit)
    var result = data.result;
    if(!offset){
        offset = 0;
    }
    if(!limit){
        limit = 10;
    }
    ctx.body={
        code:200,
        data:result.slice(offset,offset+limit),
        total:result.length
    }
})
app.use(router.routes());
app.listen(8000)